import pymysql

try:
    db=pymysql.connect('127.0.0.1','root','')
    cursor = db.cursor()    # 游标
    # cursor.execute('SELECT VERSION()')
    # cursor.execute('show databases')    # (('information_schema',), ('mysql',), ('performance_schema',), ('sys',))
    cursor.execute('use performance_schema')
    cursor.execute('show tables')
    data = cursor.fetchall()
    print(data)
    db.close()
except Exception as e:
    print(e)